using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Sys_File - 文件表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class ISysFile<T> :ModelBase<SysFile> where T : SysFile, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.FileId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return FileId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.FileId=dy.FileId;
           this.FileName=dy.FileName;
           this.Extension=dy.Extension;
           this.FilePath=dy.FilePath;
           this.FileSize=dy.FileSize;
           this.UpTime=dy.UpTime;
        } 

        #region 定义属性

     
         /// <summary>
        /// 文件ID
        /// </summary>
        private String _FileId = "";
      
        /// <summary>
        /// 文件ID
        /// </summary>
        public String FileId
        {
            get 
            {
              return   (this._FileId); 
            }

            set 
            {
                    _FileId= value;  
            }
        }
       
     
         /// <summary>
        /// 文件名称
        /// </summary>
        private String _FileName = "";
      
        /// <summary>
        /// 文件名称
        /// </summary>
        public String FileName
        {
            get 
            {
              return   (this._FileName); 
            }

            set 
            {
                    _FileName= value;  
            }
        }
       
     
         /// <summary>
        /// 文件扩展名
        /// </summary>
        private String _Extension = "";
      
        /// <summary>
        /// 文件扩展名
        /// </summary>
        public String Extension
        {
            get 
            {
              return   (this._Extension); 
            }

            set 
            {
                    _Extension= value;  
            }
        }
       
     
         /// <summary>
        /// 文件保存路径
        /// </summary>
        private String _FilePath = "";
      
        /// <summary>
        /// 文件保存路径
        /// </summary>
        public String FilePath
        {
            get 
            {
              return   (this._FilePath); 
            }

            set 
            {
                    _FilePath= value;  
            }
        }
       
     
         /// <summary>
        /// 文件大小
        /// </summary>
        private int _FileSize =int.MinValue;
      
        /// <summary>
        /// 文件大小
        /// </summary>
        public int FileSize
        {
            get 
            {
              return   (this._FileSize); 
            }

            set 
            {
                    _FileSize= value;  
            }
        }
       
     
         /// <summary>
        /// 上传时间
        /// </summary>
        private DateTime _UpTime =DateTime.MinValue;
      
        /// <summary>
        /// 上传时间
        /// </summary>
        public DateTime UpTime
        {
            get 
            {
              return   (this._UpTime); 
            }

            set 
            {
                    _UpTime= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(SysFile info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["FileId"]!= DBNull.Value)
                  {
                  info.FileId=row["FileId"].ToString();
                 }
                 
                  
                  if(row["FileName"]!= DBNull.Value)
                  {
                  info.FileName=row["FileName"].ToString();
                 }
                 
                  
                  if(row["Extension"]!= DBNull.Value)
                  {
                  info.Extension=row["Extension"].ToString();
                 }
                 
                  
                  if(row["FilePath"]!= DBNull.Value)
                  {
                  info.FilePath=row["FilePath"].ToString();
                 }
                 
                  
                  if(row["FileSize"]!= DBNull.Value)
                  {
                  info.FileSize=Convert.ToInt32(row["FileSize"]);
                 }
                 
                  
                  if(row["UpTime"]!= DBNull.Value)
                  {
                  info.UpTime=Convert.ToDateTime(row["UpTime"]);
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, SysFile info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@FileId", DbType.String,ParameterTool.GetObj( info._FileId )); 
            
             
                cn.AddInParameter(comm, "@FileName", DbType.String,ParameterTool.GetObj( info._FileName )); 
            
             
                cn.AddInParameter(comm, "@Extension", DbType.String,ParameterTool.GetObj( info._Extension )); 
            
             
                cn.AddInParameter(comm, "@FilePath", DbType.String,ParameterTool.GetObj( info._FilePath )); 
            
             
                cn.AddInParameter(comm, "@FileSize", DbType.Int32,ParameterTool.GetObj( info._FileSize )); 
            
             
                cn.AddInParameter(comm, "@UpTime", DbType.DateTime,ParameterTool.GetObj( info._UpTime )); 
            
        } 

    } 
} 